export const formConfig = {
	inline: false,
	showBtn: true,
	labelPosition: 'top',
	labelWidth: '120px',
	column: [
		{
			uploadTip: '项目小类照片',
			tip: '',
			prop: 'itemLogo',
			type: 'upload',
			labelPosition: 'top',
			showFileList: false,
			limit: 1,
			multiple: false,
			span: 12,
		},
		{
			label: '是否启用',
			prop: 'itemStatus',
			type: 'radio',
			defaultValue: 1,
			dicData: [
				{
					label: '停用',
					value: 0,
				},
				{
					label: '启用',
					value: 1,
				},
			],
			rules: [{ required: true, message: '请选择是否启用' }],
			span: 12,
		},
		{
			label: '服务小类名称',
			prop: 'itemName',
			maxlength: '50',
			showWordLimit: true,
			type: 'text',
			span: 12,
			rules: [{ required: true, message: '请输入服务小类名称' }],
		},
		{
			label: '项目类型',
			prop: 'serviceType',
			propName: 'serviceTypeLabel',
			type: 'remoteSelect',
			code: 'SERVICE_TYPE',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
			span: 12,
			rules: [{ required: true, message: '请选择项目类型' }],
		},

		{
			label: '单位',
			prop: 'itemUnit',
			type: 'select',
			dataType: 'string',
			dicData: [
				{
					label: '次',
					value: '0',
				},
				{
					label: '个',
					value: '1',
				},
			],
			rules: [{ required: true, message: '请选择单位' }],
			span: 12,
		},
		{
			label: '单价',
			prop: 'servicePrice',
			type: 'input',
			isNum: true,
			append: '（元）',
			span: 12,
		},
		{
			label: '最低服务时长',
			prop: 'minLength',
			type: 'input',
			isNum: true,
			append: '（分钟）',
			span: 12,
		},
		{
			label: '最高服务时长',
			prop: 'maxLength',
			type: 'input',
			isNum: true,
			append: '（分钟）',
			span: 12,
		},
		{
			label: '服务小类描述',
			prop: 'itemDescribe',
			type: 'textarea',
			span: 24,
		},
	],
}

export const searchConfig = {
	inline: true,
	showBtn: true,
	labelPosition: 'left',
	column: [
		{
			label: '项目名称',
			prop: 'itemName',
			type: 'input',
			span: 8,
		},
		{
			label: '项目类型',
			prop: 'serviceType',
			propName: 'serviceTypeLabel',
			type: 'remoteSelect',
			code: 'SERVICE_TYPE',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
			span: 8,
		},
		{
			label: '是否启用',
			prop: 'itemStatus',
			type: 'select',
			dicData: [
				{
					label: '停用',
					value: 0,
				},
				{
					label: '启用',
					value: 1,
				},
			],
			span: 8,
		},
	],
}

export const tableConfig = {
	stripe: true,
	border: true,
	columns: [
		{ label: '服务项目照片', custome: 'file', prop: 'itemLogo' },
		{
			label: '状态',
			prop: 'itemStatus',
			custome: 'tag',
			dicData: [
				{
					label: '停用',
					value: 0,
				},
				{
					label: '启用',
					value: 1,
				},
			],
			span: 8,
		},
		{ label: '服务名称', prop: 'itemName' },
		{ label: '服务项目类型', prop: 'serviceTypeLabel' },
		{ label: '单价', prop: 'servicePrice' },
		{
			label: '单位',
			prop: 'itemUnit',
			custome: 'tag',
			dicData: [
				{
					label: '次',
					value: '0',
				},
				{
					label: '个',
					value: '1',
				},
			],
		},
		{ label: '最低时长', prop: 'minLength' },
		{ label: '最高时长', prop: 'maxLength' },
		{
			label: '操作',
			prop: 'menu',
			width: 300,
			fixed: 'right',
		},
	],
}

export const api = {
	index: 'management_omSubItem_page',
	detail:'management_omSubItem_view',
	add: 'management_omSubItem_add',
	edit: 'management_omSubItem_edit',
	delete: 'management_omSubItem_del',
}
export const auth = {
	...api,
}
export const baseConfig = {
	pageName: '服务项目-小类',
	dictcodes: ['ROLE_TIER'],
	rowKey: 'id',
	addLabel: '新增',
	tipLabel: 'itemName',
	exportMqTopic: '/ning/export/',
	api,
	auth,
	menuBtn: [
		{
			icon: 'editor',
			label: '编辑',
			type: 'primary',
			operate: 'edit',
			auth: auth.edit,
			text: true,
			show: true,
		},
		{
			icon: 'delete',
			label: '删除',
			type: 'danger',
			operate: 'delete',
			auth: auth.delete,
			text: true,
			show: true,
		},
		{
			icon: 'detail',
			label: '详情',
			type: 'primary',
			operate: 'detail',
			auth: auth.index,
			text: true,
			show: true,
		},
	],

	saveFormate: async (form) => {
		return new Promise((resolve, reject) => {
			resolve(form)
		})
	},
	beforeOnLoadFormate: async (query) => {
		return new Promise((resolve, reject) => {
			resolve(query)
		})
	},
	onLoadFormate: async (arr) => {
		return new Promise((resolve, reject) => {
			resolve(arr)
		})
	},
	dialogConfig: {
		width: '65%',
	},
	searchConfig,
	formConfig,
	tableConfig,
	detailConfig: formConfig,
}
